<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>入库组盘</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="../css/mui.min.css">
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="../css/app.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">入库组盘</h1>
		</header>
		<div class="mui-content">
			
			<input id="boxCodeInput" type="text" class="mui-input-clear" placeholder="托盘条码" 
					   >
			<button id="addBoxCode" type="button" class="mui-btn  mui-btn-primary mui-btn-block" ">新增</button>

			<ul id="OA_task_2" class="mui-table-view">
			</ul>
			<h5 class="mui-content-padded" style="margin: 15px 10px;">备选明细</h5>
			<ul id="OA_task_1" class="mui-table-view">
			</ul>

			<div id="removeTmp" style="visibility: hidden;">
				<div style="display: none;">sgj_id</div>
				<!-- <div class="mui-slider-left mui-disabled">
					<a class="mui-btn mui-btn-red">删除</a>
				</div> -->
				<div class="mui-slider-right mui-disabled">
					<a class="mui-btn mui-btn-red">删除</a>
				</div>
				<div class="mui-slider-handle">
					sgj_data
				</div>
			</div>
			<div id="addTmp" style="visibility: hidden;">
				<div style="display: none;">sgj_id</div>
				<!-- <div class="mui-slider-left mui-disabled">
					<a class="mui-btn mui-btn-red">绑定</a>
				</div> -->
				<div class="mui-slider-right mui-disabled">
					<a class="mui-btn mui-btn-red">绑定</a>
				</div>
				<div class="mui-slider-handle">
					sgj_data
				</div>
			</div>

		</div>

	</body>
	<script src="../js/mui.js"></script>
	<script>
		mui.init();

		function loadOther() {
			mui.post("CoreStock/findDetailPage", {
				pid: 0,
				storeStatus: 2,
				pageNum: 1,
				pageSize: 200
			}, function(response) {
				if (response.code != "200") {
					mui.toast(response.msg)
				} else {
					var content = document.body.querySelector('#OA_task_1');
					content.innerHTML = ""
					var list = response.data.content;
					appendChind(content, list, "#addTmp");
				}
			}, "json");
		}
		var btnArray = ['确认', '取消'];

		function deleteDet(event) {
			var elem = this;
			mui.confirm('确认删除该条记录？', 'Hello MUI', btnArray, function(e) {
				if (e.index == 0) {
					mui.post("CoreStock/setDetailStock", {
						id: elem.children[0].innerHTML
					}, function(response) {
						queryAll()
					}, "json");
				} else {
					setTimeout(function() {
						mui.swipeoutClose(elem);
					}, 0);
				}
			});
		}

		function addDet(event) {
			var elem = this;
			mui.confirm('确认绑定该条记录？', 'Hello MUI', btnArray, function(e) {
				if (e.index == 0) {
					mui.post("CoreStock/setDetailStock", {
						id: elem.children[0].innerHTML,
						pid: selectStock.id
					}, function(response) {
							mui.toast(response.data.msg)
						queryAll();
						
						//document.getElementById("boxCodeInput").value=''
					}, "json");
				} else {
					setTimeout(function() {
						mui.swipeoutClose(elem);
					}, 0);
				}
			});
		}


		document.getElementById('addBoxCode').addEventListener('tap',
			function() {
				document.getElementById("addBoxCode").disabled=true;
				mui.post("CoreStock/SaveStock", {
					main:{boxcode: document.getElementById("boxCodeInput").value}
					
				}, function(response) {
					if (response.code != "200") {
						mui.confirm(response.msg);
					} else {
						mui.confirm('成功');
						queryAll();
						document.getElementById("addBoxCode").disabled=false;
					}
				}, "json");
			}, false);



		mui('#OA_task_2').on('slideleft', '.mui-table-view-cell', deleteDet);
		mui('#OA_task_2').on('slideright', '.mui-table-view-cell', deleteDet);

		mui('#OA_task_1').on('slideleft', '.mui-table-view-cell', addDet);
		mui('#OA_task_1').on('slideright', '.mui-table-view-cell', addDet);
	</script>
	<script src="kj.js"></script>

</html>